object BasicForLoopDemo extends App {

  val mathScores: List[Int] = List(85, 92, 78, 90, 88, 76, 95, 82, 89, 79)
  var totalScore = 0
  for (score <- mathScores){
    totalScore += score
    println(s"处理成绩：$score，当前总分：$totalScore")
  }
  val averageScore = totalScore.toDouble / mathScores.length
  println(s"\n班级数学成绩总分：$totalScore")
  println(f"班级数学成绩平均分：$averageScore%.1f")
}
